const data = {
  name: '张三',
  age: 14
}

let value = data.name

Object.defineProperty(data, 'name', {
  get () {
    console.log('读数据了')
    return value
  },
  set (val) {
    console.log('写数据了' + val)
    value = val
  }
})

console.log(data.name)
data.name = '赵四'
console.log(data.name)